package main

import (
	"fmt"
)

func main() {
	var n int
	var k int
	fmt.Scan(&n)
	fmt.Scan(&k)
	count := 0

	var arr = make([]int, n)
	for i := 0; i < n; i++ {
		var v int
		fmt.Scan(&v)
		arr[i] = v
	}

	k = k - 1
	kv := arr[k]

	for _, v := range arr {
		if v >= kv && v > 0 {
			count++
		} else {
			break
		}
	}
	fmt.Println(count)
}
